<!doctype html>
<html class="no-js">
<head>
<include file="Public:top"/>
</head>
<body>
<!--[if lte IE 9]><p class="browsehappy">升级你的浏览器吧！ <a href="http://se.360.cn/" target="_blank">升级浏览器</a>以获得更好的体验！</p><![endif]-->

</head>

<body>

<header class="am-topbar admin-header">
 <include file='Public:header'/>
</header>
<div class="am-cf admin-main">
<include file='Public:left'/>
  <div class=" admin-content">
    <div class="daohang">
      <ul>
        <li><a href="{:U('Admin/Index/index')}">
        <button type="button" class="am-btn am-btn-default am-radius am-btn-xs">
        首页
        </a></li>
 
      </ul>
    </div>
    <div class="am-popup am-popup-inner" id="my-popup">
      <div class="am-popup-hd">
        <h4 class="am-popup-title">添加商品一级分类</h4>
        <span data-am-modal-close
            class="am-close">&times;</span> </div>
      <div class="am-popup-bd">
        <form class="am-form tjlanmu" method="post" action="check">
          <div class="am-form-group">
            商品分类名称：
            <div class="you">
              <input type="text" class="am-input-sm" id="doc-ipt-email-1" name="wares_TypeName"  placeholder="请输入标题">
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">商品数量：</div>
            <div class="you">
              <input type="text" size="20px" name="wares_Typenum">
              
            </div>
          </div>
          <div class="am-form-group am-cf">
            <div class="zuo">简介：</div>
            <div class="you">
              <textarea class="" rows="2" id="doc-ta-1" name="wares_Typeintro" ></textarea>
            </div>
          </div>

          <div class="am-form-group am-cf">
            <div class="you">
              <p>
                <button type="submit" class="am-btn am-btn-success am-radius">提交</button>
              </p>
            </div>
          </div>
        </form>
      </div>
    </div>


    
   <!--        <div class="am-popup am-popup-inner" id="my-popups">
           <div class="am-popup-hd">
   <h4 class="am-popup-title">添加商品子分类</h4>
   <span data-am-modal-close class="am-close">&times;</span> </div>
           <div class="am-popup-bd">
   <form class="am-form tjlanmu" method="post" action="review">
     <div class="am-form-group">
       <div class="zuo">商品名称：</div>
       <div class="you">
         <input type="hidden" name="id" value="{$Think.cookie.id}">
         <input type="email" class="am-input-sm" id="doc-ipt-email-1" name="wares_name" placeholder="{$id}">
       </div>
     </div>    
     <div class="am-form-group am-cf">
       <div class="zuo">商品描述：</div>
       <div class="you">
         <textarea class="" rows="2" id="doc-ta-1"></textarea>
       </div>
     </div>
      <div class="am-form-group am-cf">
       <div class="zuo">简介：</div>
       <div class="you">
         <textarea class="" rows="2" id="doc-ta-1" name="wares_abstruct"></textarea>
       </div>
     </div>
     <div class="am-form-group am-cf">
       <div class="zuo">分类等级：</div>
       <div class="you" style="margin-top: 3px;">
         <input type="text" name="pid" value="{$arr.pid}">
       </div>
     </div>
     <div class="am-form-group am-cf">
       <div class="you">
         <p>
           <button type="submit" class="am-btn am-btn-success am-radius">提交</button>
         </p>
       </div>
     </div>
   </form>
           </div>
         </div>
        -->
    
    
    
    
 <!--    
 <div class="am-popup am-popup-inner" id="my-popupss">
     <div class="am-popup-hd">
       <h4 class="am-popup-title">复制栏目</h4>
       <span data-am-modal-close class="am-close">&times;</span> </div>
     <div class="am-popup-bd">
       <form class="am-form tjlanmu" method="post" action="check">
       
       
       <div class="am-form-group">
           <div class="zuo">复制到：</div>
           <div class="you">
           
   <select data-am-selected="{btnWidth: 200, btnSize: 'sm', btnStyle: 'danger'}">
   <option value="a">Apple</option>
   <option value="b">Banana</option>
   <option value="o">Orange</option>
   <option value="m">Mango</option>
 </select>
  顶级栏目选默认
 
           </div>
         </div>
       
       
         <div class="am-form-group">
           <div class="zuo">新商品名称：</div>
           <div class="you">
             <input type="email" class="am-input-sm" id="doc-ipt-email-1" placeholder="请输入标题">
           </div>
         </div>         
         <div class="am-form-group am-cf">
           <div class="zuo">商品描述：</div>
           <div class="you">
             <textarea class="" rows="2" id="doc-ta-1"></textarea>
           </div>
         </div>
         <div class="am-form-group am-cf">
           <div class="zuo">商品图片：</div>
           <div class="you" style="height: 45px;">
             <input type="file" id="doc-ipt-file-1">
             <p class="am-form-help">请选择要上传的文件...</p>
           </div>
         </div>
         <div class="am-form-group am-cf">
           <div class="zuo">简介：</div>
           <div class="you">
             <textarea class="" rows="2" id="doc-ta-1"></textarea>
           </div>
         </div>
         <div class="am-form-group am-cf">
           <div class="zuo">状态：</div>
           <div class="you" style="margin-top: 3px;">
             <label class="am-checkbox-inline">
               <input type="checkbox" value="option1">
               显示 </label>
             <label class="am-checkbox-inline">
               <input type="checkbox" value="option2">
               隐藏 </label>
           </div>
         </div>
         <div class="am-form-group am-cf">
           <div class="you">
             <p>
               <button type="submit" class="am-btn am-btn-success am-radius">提交</button>
             </p>
           </div>
         </div>
       </form>
     </div>
   </div> -->
    
    
    
    
    
    
    
    
    
    
    <div class="admin-biaogelist">
      <div class="listbiaoti am-cf">
        <ul class="am-icon-flag on">
          商品栏目管理
        </ul>
        <dl class="am-icon-home" style="float: right;">
          当前位置： 首页 > <a href="#">商品列表</a>
        </dl>
        <dl>
          <button type="button" class="am-btn am-btn-danger am-round am-btn-xs am-icon-plus" data-am-modal="{target:'#my-popup'}">添加商品一级分类</button>
        </dl>
        <!--data-am-modal="{target: '#my-popup'}" 弹出层 ID  弹出层 190行 开始  271行结束--> 
        
      </div>
      <form class="am-form am-g">
        <table width="100%" class="am-table am-table-bordered am-table-radius am-table-striped am-table-hover">
          <thead>
            <tr class="am-success">
              <th class="table-check"><input type="checkbox" /></th>
              <th class="table-id">排序</th>
              <th class="table-id am-text-center">ID</th>
              <th class="table-title">商品分类名称</th>
              <th class="table-type">商品数量</th>
              <th class="table-title">商品分类等级</th>
              <th class="table-date am-hide-sm-only">添加商品时间</th>
              <th width="163px" class="table-set">操作</th>
            </tr>
          </thead>
          <tbody>
            <foreach name="arr" item="v">
            <tr>
              <td><input type="checkbox" /></td>
              <td><input type="text" class="am-form-field am-radius am-input-sm"/></td>
              <td class="am-text-center">{$v.id}</td>
              <td><a href="#">{$v['html']}{$v['wares_typename']}</a></td>
              <td>{$v['wares_typenum']}</td>
              <td>
              <if condition="$v.level eq 1">
                    <span style='color:#F00'>一级分类</span>
              </if>
              <if condition="$v.level eq 2">
                    <span style='color:#0F0'>二级分类</span>
              </if>
              <if condition="$v.level eq 3">
                    <span style='color:#00F'>三级分类</span>
              </if>
              </td>
              <td class="am-hide-sm-only">{$v['wares_addtime']}</td>
              <td><div class="am-btn-toolbar">
                  <div class="am-btn-group am-btn-group-xs">
                  <a class="am-btn am-btn-default am-btn-xs am-text-success am-round am-icon-file"  title="添加子栏目" onclick="add({$v['id']})"></a>

                  <button class="am-btn am-btn-default am-btn-xs am-text-secondary am-round" onclick="upd({$v['id']})" title="修改"><span class="am-icon-pencil-square-o" ></span></button>
                  <!-- 用按钮的时候 弹层 后缀需要加 问好 ？#的 时候才有效 真恶心 .html?# -->
                    
                    
                  <button class="am-btn am-btn-default am-btn-xs am-text-warning  am-round"  title="复制" data-am-modal="{target: '#my-popupss'}" ><span class="am-icon-copy"></span></button>
                  <!-- 做完发现 复制栏目没什么用处 早晚都要修改 -->
                    
                    
                    <a class="am-btn am-btn-default am-btn-xs am-text-danger am-round"  title="删除" onclick="del({$v['id']})"><span class="am-icon-trash-o"></span></a>
                  </div>
                </div></td>
            </tr>
            </foreach>
          </tbody>

        </table>
          <ul class="am-pagination am-fr">
              {show}
          </ul>
        <div class="am-btn-group am-btn-group-xs">
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 删除</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 上架</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 下架</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 移动</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-plus"></span> 新增</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-save"></span> 保存</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-archive"></span> 移动</button>
          <button type="button" class="am-btn am-btn-default"><span class="am-icon-trash-o"></span> 删除</button>
        </div>
        <hr />
        <p>
        备注：操作图标含义
         <a class="am-text-success am-icon-file" title="添加子分类"> 添加子分类</a> 
         <a class="am-icon-pencil-square-o am-text-secondary" title="修改"> 修改栏目</a> 
         <a class="am-icon-copy am-text-warning" title="复制"> 复制栏目</a> 
         <a class="am-icon-trash-o am-text-danger" title="删除"> 删除栏目</a>
         

        
        
        
        
        </p>
      </form>

      <div class="foods">
  <include file='Public:footer'/>
      </div>
    </div>
  </div>
</div>
<div style="display:none" id="add">
       <table cellpadding="0" cellspacing="0" class="layui-table" style="width:800px" lay-skin="row">
            <tr>
                <td>商品名称:</td>
                <td><input type="text" id="wares_typename" name="wares_typename" class="layui-input" placeholder="请输入商品名称"></td>
            </tr>
            <tr>
                <td>商品数量:</td>
                <td><input type="text" id="wares_typenum" name="wares_typenum" class="layui-input" placeholder="请输入商品简介"></td>
            </tr>
            <tr>
                <td>商品简介:</td>
                <td><textarea  id="wares_typeintro" name="wares_typeintro" class="layui-textarea" cols="20" rows="5" ></textarea></td>
            </tr>
        </table>

</div>


<!--[if lt IE 9]>
<script src="http://libs.baidu.com/jquery/1.11.1/jquery.min.js"></script>
<script src="http://cdn.staticfile.org/modernizr/2.8.3/modernizr.js"></script>
<script src="assets/js/polyfill/rem.min.js"></script>
<script src="assets/js/polyfill/respond.min.js"></script>
<script src="assets/js/amazeui.legacy.js"></script>
<![endif]--> 

<!--[if (gte IE 9)|!(IE)]><!--> 
<script src="__PUBLIC__/Admin/js/amazeui.min.js"></script> 
<script src="__PUBLIC__/Admin/js/jquery.cookies.2.2.0.min.js"></script> 

<!--<![endif]-->
<script>
  function add(id){

      layui.use('layer', function () {
            layer.open({          // 普通信息弹窗
                    type:1,
                    title:'添加商品子类信息',
                    content:$("#add"),
                    shadeClose:true,
                    area:['800px','600px'],
                    btn:['确定','取消'],
                    btn1: function (index) {
                        $.ajax({
                           type:'POST',
                           url:'censor',
                           data:'pid='+id+'&wares_typename='+$('#wares_typename').val()+'&wares_typenum='+$('#wares_typenum').val()+'&wares_typeintro='+$('#wares_typeintro').val(),
                           dataType:'json',
                           success:function(data){
                               if(data == 1){
                                 layer.msg('添加成功',{icon:6,time:500},function(){
                                     location.href = location.href;
                                 })
                                 layer.close(index);
                               }else{
                                  layer.msg('添加失败',{icon:7,time:500});  
                               }
                           },
                           error:function(data){
                              console.log(data);
                           }
                        })
                    },
                    btn2: function () {
                        layer.msg('取消添加',{icon:7,time:2000})
                    }

            });
        })
  }
    function del(id){
    layui.use('layer', function () {
      var layer = layui.layer;
      layer.confirm('确定删除？',{icon:3,title:'删除'}, function (index) {
          $.get('type_del?id='+id,function(data){
              if(data == 1){
                  layer.msg('删除成功!',{icon:6,time:500}, function () {
                      location.href = location.href;

                })
            }
        })

    })
})
}
</script>
</body>
</html>